package com.sora.pipeline.domain.dto;

import jakarta.validation.constraints.*;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 缺陷创建/更新请求DTO
 * 
 * @author system
 * @since 2025-01-20
 */
@Data
public class DefectRequest {
    
    /**
     * 线路ID
     */
    @NotNull(message = "线路ID不能为空")
    private Long lineId;
    
    /**
     * 里程桩
     */
    @Size(max = 80, message = "里程桩长度不能超过80字符")
    private String milestone;
    
    /**
     * 里程桩ID
     */
    private Long milestoneId;
    
    /**
     * 缺陷类型ID
     */
    @NotNull(message = "缺陷类型不能为空")
    private Integer typeId;
    
    /**
     * 缺陷等级ID
     */
    @NotNull(message = "缺陷等级不能为空")
    private Integer levelId;
    
    /**
     * 状态：pending/confirmed/in_progress/completed/closed
     */
    @Pattern(regexp = "^(pending|confirmed|in_progress|completed|closed)$", 
             message = "状态只能是pending/confirmed/in_progress/completed/closed")
    private String status;
    
    /**
     * 位置描述
     */
    @Size(max = 255, message = "位置描述长度不能超过255字符")
    private String location;
    
    /**
     * 缺陷描述
     */
    @NotBlank(message = "缺陷描述不能为空")
    @Size(max = 1000, message = "缺陷描述长度不能超过1000字符")
    private String description;
    
    /**
     * 报告人ID
     */
    private Long reporterId;
    
    /**
     * 报告时间
     */
    private LocalDateTime reportTime;
    
    /**
     * 图片JSON
     */
    private String imagesJson;
    
    /**
     * 备注
     */
    @Size(max = 500, message = "备注长度不能超过500字符")
    private String remarks;
    
    /**
     * 附件列表
     */
    private List<AttachmentInfo> attachments;
    
    /**
     * 附件信息
     */
    @Data
    public static class AttachmentInfo {
        /**
         * 文件类型
         */
        private String fileType;
        
        /**
         * 文件名
         */
        private String fileName;
        
        /**
         * 文件URL
         */
        private String fileUrl;
        
        /**
         * 文件大小
         */
        private Long fileSize;
    }
}
